<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>
<div class="layui-fluid" id="app">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <table class="layui-table" lay-skin="line">
                <thead>
                <tr>
                    <th>头像</th>
                    <th>姓名</th>
                    <th>工种</th>
                    <th>电话</th>
                    <th></th>
                    <th style="width: 20%"></th>
                </tr>
                </thead>
                <tbody>
                <tr v-for="(item,index) in items" :data_id="item.id">
                    <td>
                        <img v-if="item.avatar2=='0'" src="/res/img/thumb.png"
                             style="max-width: 50px;">
                        <img v-else :src="item.avatar2" style="max-width: 50px;">
                    </td>
                    <td>{{item.truename}}</td>
                    <td>{{item.gongzhong}}</td>
                    <td>{{item.phone}}</td>
                    <td>
                        <i v-if="item.status==2" class="layui-icon"
                           style="font-size: 20px; color:red;">&#xe605;</i>
                        <i v-else></i>
                    </td>
                    <td>
                        <div class="layui-btn-group">
                            <button class="layui-btn layui-btn-sm layui-btn-primary"
                                   :data_id="item.id" :wid="item.worker_id" :sid="item.stage_id" :type="item.gongzhong"
                                    onclick="agree(this)">验收
                            </button>

                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

    </div>
</div>

<script>


    //vue对象
    var app = new Vue({
        el: '#app',
        data: {
            items: [],
        },
    });

    $(function () {
        init();
    });
    function init() {
        $.get("{:url('yanshou')}", {id:"{$Request.param.id}"},
            function (res) {
                layer.closeAll();
                app.items = res.data;
                console.log(res.data);
            }
        );
    }
    layui.use(['table', 'layer'], function () {
        var layer = layui.layer;
        var table = layui.table;
    });


    function agree(that) {
        var yid = $(that).attr('data_id');
        var sid = $(that).attr('sid');
        var wid = $(that).attr('wid');
        var type = $(that).attr('type');
        // console.log(id);
        // console.log(sid);
        // console.log(wid);
        var path = "{:url('worker_price')}?yid=" +yid+"&sid="+sid+"&wid="+wid+"&type="+type;
        console.log(path);
        layer.open({
            type: 2,
            title: '工价',
            shadeClose: false,
            shade: 0.01,
            area: ['30%', '40%'],
            content: path
        });
    }

</script>


</body>
</html>




